import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import VueAMap, { initAMapApiLoader } from '@vuemap/vue-amap';
import '@vuemap/vue-amap/dist/style.css'
import { BASE } from "@net/url"
import horizontalScroll from 'el-table-horizontal-scroll'

initAMapApiLoader({
    key: '57a3de0da08ab92b7668cb60f98b70da',
    plugins: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Geocoder'],
    serviceHost: BASE + '_AMapService'
});

const pinia = createPinia()
const app = createApp(App)
app.use(pinia).use(router).use(VueAMap).use(horizontalScroll).mount('#app')


for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

// import ElementPlus from 'element-plus'
// import zhCn from 'element-plus/es/locale/lang/zh-cn'

// app.use(ElementPlus, {
//     locale: zhCn,
// })

Array.prototype.remove = function(func) {
    for (var i = this.length - 1; i >= 0; i--) {
        if (func(this[i])) {
            this.splice(i, 1);
        }
    }
    return this
}